package com.shdaily.android;

import java.util.List;
import javax.xml.parsers.*;

public class SaxFeedParser extends BaseFeedParser {

    protected SaxFeedParser(String feedUrl){
        super(feedUrl);
    }
    
    public List<Article> parse() {
        SAXParserFactory factory = SAXParserFactory.newInstance();
        try {
            SAXParser parser = factory.newSAXParser();
            FeedHandler handler = new FeedHandler("metro" , 10 , 0, 0);
            parser.parse(this.getInputStream(), handler);
            return handler.getArticles();
        } catch (Exception e) {
            throw new RuntimeException(e);
        } 
    }
}